# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudIdentity.V1.Model.MemberRelation do
  @moduledoc """
  Message representing a transitive membership of a group.

  ## Attributes

  *   `member` (*type:* `String.t`, *default:* `nil`) - Resource name for this member.
  *   `preferredMemberKey` (*type:* `list(GoogleApi.CloudIdentity.V1.Model.EntityKey.t)`, *default:* `nil`) - Entity key has an id and a namespace. In case of discussion forums, the id will be an email address without a namespace.
  *   `relationType` (*type:* `String.t`, *default:* `nil`) - The relation between the group and the transitive member.
  *   `roles` (*type:* `list(GoogleApi.CloudIdentity.V1.Model.TransitiveMembershipRole.t)`, *default:* `nil`) - The membership role details (i.e name of role and expiry time).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :member => String.t() | nil,
          :preferredMemberKey => list(GoogleApi.CloudIdentity.V1.Model.EntityKey.t()) | nil,
          :relationType => String.t() | nil,
          :roles => list(GoogleApi.CloudIdentity.V1.Model.TransitiveMembershipRole.t()) | nil
        }

  field(:member)
  field(:preferredMemberKey, as: GoogleApi.CloudIdentity.V1.Model.EntityKey, type: :list)
  field(:relationType)
  field(:roles, as: GoogleApi.CloudIdentity.V1.Model.TransitiveMembershipRole, type: :list)
end

defimpl Poison.Decoder, for: GoogleApi.CloudIdentity.V1.Model.MemberRelation do
  def decode(value, options) do
    GoogleApi.CloudIdentity.V1.Model.MemberRelation.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudIdentity.V1.Model.MemberRelation do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
